package auctions;

/** A buyer implementing this strategy will bid 10% higher than the current 
 * price as long as the resulting price is lower than his maximum price. If that
 * is not possible then he will bid his maximum price.
 */
public class EnglishSimpleBuyer implements EnglishBuyerStrategy {
    
    public int acceptOffer(int itemsTotal, int itemsToBuy, int price,
                           int maxPrice) {
        int p = (int)Math.round(price * 1.1);
        if(p <= maxPrice) {
            return p;
        } else if(price < maxPrice){
            return maxPrice;
        } else {
            return -1;
        }
    }
}
